#ifndef _UFO_DATA_MATRIX_H_
#define _UFO_DATA_MATRIX_H_

#define UFO_PI 3.1415926535897932f

typedef union _ufoVector3
{
	struct
	{
		float x,y,z;
	};
	float v[3];
}ufoVector3;

typedef union _ufoMatrix4
{
	struct
	{
		float e00;
		float e10;
		float e20; 
		float e30;

		float e01;
		float e11;
		float e21;
		float e31;

		float e02;
		float e12;
		float e22;
		float e32;

		float e03;
		float e13;
		float e23;
		float e33;
	};
	float mElements[16];
}ufoMatrix4;

int ufoIndentityMatrix(ufoMatrix4 *matrix);

float ufoMatrixGetElement(ufoMatrix4 *matrix, int row, int column);

int ufoMatrixSetElement(ufoMatrix4 *matrix, int row, int column, float v);

int ufoMultMatrix(ufoMatrix4 *output, ufoMatrix4 *in1, ufoMatrix4 *in2);

int ufoTranslateMatrix(ufoMatrix4 *matrix, float x, float y, float z);

int ufoScaleMatrix(ufoMatrix4 *matrix, float x, float y, float z);

int ufoMatrixRotate(ufoMatrix4 *matrix, float fradian, float x, float y, float z);

int ufoOrthoMatrix(ufoMatrix4 *matrix, float left, float right, float bottom, float top, float nearVal, float farVal);

int ufoPerspectiveMatrix(ufoMatrix4 *matrix, float fovyInRadian, float aspect, float nearVal, float farVal);

int ufoMatrixLookAt(ufoMatrix4 *matrix, const ufoVector3 *eye, const ufoVector3 *center, const ufoVector3 *up);

int ufoVectorMinus(ufoVector3 *vector3, const ufoVector3 *in1, const ufoVector3 *in2);

int ufoVectorMult(ufoVector3 *vector3, const ufoVector3 *in1, const ufoVector3 *in2);

int ufoVectorNormalize(ufoVector3 *vector);

#endif